#include<bits/stdc++.h>
using namespace std; 
int main()
{ 
    long long n = 59084709587505;
    int ans = 0;
    for(long long i = 1; i <= n; i *= 3) 
    {
        for(long long j = 1; i*j <= n; j *= 5)
        {
            for(long long k = 1; k*i*j <= n; k *= 7)
            {
                ans++;
            }
        }
    }
    cout << ans - 1;
    return 0;
}